<template>
  <div class="content">
    <div class="kqysDiv">
      <TitleVue :name="'库区要素'" />
      <div class="kqysContent">
        <div class="itemDiv" v-for="(item, index) in kqysList" :key="index">
          <img :src="require('@/assets/img/common/' + item.name + '.png')" alt="" />

          <div class="rightDiv">
            <div class="contents">
              <span>{{ item.name }}</span>
              <span>{{ item.val }} {{ item.unit }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="jkDiv">
      <TitleVue :name="'无人机巡检'" />

      <div class="xjDiv">
        <div class="leftDiv">
          <img src="@/assets/img/common/无人机.png" alt="" />
        </div>
        <div class="rightDiv">
          <div><img src="@/assets/img/yxt1.png" /></div>
          <div><img src="@/assets/img/yxt2.png" /></div>
        </div>
      </div>
      <div class="buttonDiv">
        <span :style="{ color: dialogType == '历史记录' ? '#00ffff' : '#fff' }" @click="changePage('历史记录')">·历史记录</span>
        <span :style="{ color: dialogType == '任务列表' ? '#00ffff' : '#fff' }" @click="changePage('任务列表')">·任务列表</span>
      </div>
    </div>

    <div class="spjkDiv">
      <TitleVue :name="'视频监控'" />
      <div class="spjkContent">
        <div class="itemDiv" v-for="(item, index) in spjkList" :key="index" @click="openVideo(item)">
          <span>{{ index }}</span>
          <span>{{ item.name }}</span>
        </div>
      </div>
    </div>
    <div v-if="showDialog" class="mask-layer">
      <div class="dialog">
        <div class="closeDiv">
          <i class="el-icon-close" @click="closeList()"></i>
        </div>
        <el-table :data="lsjlList" style="width: 100%" v-if="dialogType == '历史记录'">
          <el-table-column type="index" label="序号"> </el-table-column>
          <el-table-column prop="xjrq" label="巡检日期" align="center"> </el-table-column>
          <el-table-column prop="xjzt" label="巡检状态" align="center"> </el-table-column>
        </el-table>
        <el-table :data="rwlbList" style="width: 100%" v-if="dialogType == '任务列表'">
          <el-table-column type="index" label="序号"> </el-table-column>

          <el-table-column prop="rwmc" label="任务名称" align="center"> </el-table-column>
          <el-table-column prop="jhxjrq" label="计划巡检日期" align="center"> </el-table-column>
        </el-table>
      </div>
    </div>
    <!-- 视频播放器 -->
    <VideoPlayer v-if="videoPlayerInfo.show" />
  </div>
</template>
 
<script>
import TitleVue from '../common/titleVue.vue'
import VideoPlayer from '@/components/videoPlayer'
import { mapState } from 'vuex'

export default {
  name: 'QthLeft',
  components: {
    TitleVue,
    VideoPlayer
  },
  data() {
    return {
      kqysList: [
        {
          name: '1h降雨量',
          val: 10,
          unit: 'mm'
        },
        {
          name: '实时水位',
          val: 1107.03,
          unit: 'm'
        },
        {
          name: '实时库容',
          val: 1106.96,
          unit: 'm³'
        }
      ],
      spjkList: [
        {
          name: '上游'
        },
        {
          name: '下游'
        },
        {
          name: '大坝'
        },
        {
          name: '环库'
        },
        {
          name: '东通'
        },
        {
          name: '西通'
        }
      ],
      dialogType: null,
      lsjlList: [
        {
          xjrq: '2024-12-03',
          xjzt: '已巡检'
        },
        {
          xjrq: '2025-1-22',
          xjzt: '已巡检'
        },
        {
          xjrq: '2025-2-06',
          xjzt: '已巡检'
        },
        {
          xjrq: '2025-3-13',
          xjzt: '已巡检'
        }
      ],
      rwlbList: [
        { rwmc: '2024年3月日常巡检', jhxjrq: '2025-3-13' },
        { rwmc: '2024年2月日常巡检', jhxjrq: '2025-2-06' },
        { rwmc: '2025年1月日常巡检', jhxjrq: '2025-1-22' },
        { rwmc: '2024年12月日常巡检', jhxjrq: '2024-12-03' }
      ],
      showDialog: false
    }
  },
  computed: {
    ...mapState(['videoPlayerInfo'])
  },
  mounted() {},
  methods: {
    changePage(val) {
      this.dialogType = val
      this.showDialog = true
    },
    closeList() {
      this.showDialog = false
      this.dialogType = null
    },
    openVideo(item) {
      this.$store.commit('setVideo', {
        show: true,
        ...item
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  .mask-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    ::v-deep .el-table td.el-table__cell,
    .el-table th.el-table__cell.is-leaf {
      border-bottom: 0px solid transparent;
    }
    ::v-deep .el-table--border::after,
    .el-table--group::after,
    .el-table::before {
      background-color: transparent;
    }
    ::v-deep .el-table tr {
      background: #031d31;
      color: #ccc;
      font-family: Regular;
      border: none !important;
    }
    ::v-deep.el-table td.el-table__cell,
    .el-table th.el-table__cell.is-leaf {
      background: #031d31;
      color: #ccc;
      font-family: Regular;
      border: none !important;
    }
    ::v-deep .el-table th.el-table__cell.is-leaf {
      border: none !important;
    }
    ::v-deep .el-table th.el-table__cell {
      background: #031d31;
      color: #ccc;
      font-family: Regular;
      border: none;
    }
    ::v-deep .el-table__inner-wrapper::before {
      background-color: transparent;
    }
    ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
      background: #031d31 !important;
    }

    .dialog {
      position: absolute;
      top: 30vh;
      left: 35vw;
      background-color: #07182b;
      width: 30vw;
      height: auto;
      z-index: 999;
      color: #ffffff;
      padding: 1vh 1vw 2vh 1vw;
      box-sizing: border-box;
      .closeDiv {
        width: 100%;
        height: auto;
        display: flex;
        justify-content: end;
        margin-bottom: 10px;
        .el-icon-close {
          font-size: 2.2vh;
          line-height: 3vh;
          cursor: pointer;
        }
      }
    }
  }
  .kqysDiv {
    width: 100%;
    height: auto;
    background-color: #0c2a4966;
    backdrop-filter: blur(0px);
    padding: 0 5px;
    box-sizing: border-box;
    margin-bottom: 8px;
    .kqysContent {
      display: flex;
      flex-direction: column;
      padding: 0 1vh 1vh;
      box-sizing: border-box;
      .itemDiv {
        width: 100%;
        height: auto;
        display: flex;
        font-family: Source Han Sans CN;
        font-weight: 400;
        font-size: 1.7vh;
        color: #00ffff;
        img {
          margin-right: 0.3vw;
        }
        .rightDiv {
          width: auto;
          flex: 1;
          display: flex;
          align-items: center;
          .contents {
            width: 100%;
            height: 3vh;
            line-height: 3vh;
            display: flex;
            justify-content: space-between;
            padding: 0 10px;
            box-sizing: border-box;
            background: linear-gradient(to right, #0565a7, transparent);
          }
        }
      }
    }
  }
  .jkDiv {
    flex: 1;
    width: 100%;
    overflow: hidden;
    background-color: #0c2a4966;
    backdrop-filter: blur(0px);
    padding: 0 5px 1vh;
    box-sizing: border-box;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    .xjDiv {
      flex: 1;
      display: flex;
      padding: 0 1vh;
      box-sizing: border-box;
      overflow: hidden;
      .leftDiv {
        width: 65%;
        height: 100%;
        padding: 5% 5% 5% 3%;
        box-sizing: border-box;
        img {
          width: 100%;
          height: 100%;
        }
      }

      .rightDiv {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        div {
          width: 100%;
          height: 45%;
          background: #21447b;
          padding: 5px;
          box-sizing: border-box;
          border-radius: 10px;
          img {
            width: 100%;
            height: 100%;
          }
        }
      }
    }
    .buttonDiv {
      width: 100%;
      height: 4vh;
      padding: 0 1vh;
      box-sizing: border-box;
      font-family: Source Han Sans CN;
      font-weight: 400;
      line-height: 4vh;
      font-size: 1.7vh;
      color: #fff;
      background: linear-gradient(to right, #0565a7, transparent);
      display: flex;
      justify-content: space-around;
      span {
        cursor: pointer;
      }
    }
  }

  .spjkDiv {
    width: 100%;
    height: auto;
    flex: 1;
    background-color: #0c2a4966;
    backdrop-filter: blur(0px);
    padding: 0 5px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    .spjkContent {
      flex: 1;
      padding: 1vh 0.5vw;
      box-sizing: border-box;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-around;
    }
    .itemDiv {
      width: 48%;
      height: 6vh;
      background: url('@/assets/img/common/d1.png') no-repeat;
      background-size: 100% 100%;
      font-family: Source Han Sans CN;
      font-weight: 400;
      font-size: 1.7vh;
      color: #fff;
      padding: 1.2vh 7vh 0 3vh;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      cursor: pointer;
    }
  }
}
</style>
